home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / ac2vb3 / frmdemom.frm < prev    next >
Text File  |  1994-03-01  |  20KB  |  676 lines

  1. VERSION 2.00
  2. Begin Form frmDemoMain 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "JET 2.0 VB3 Demo"
  5.    ClientHeight    =   6390
  6.    ClientLeft      =   1485
  7.    ClientTop       =   1635
  8.    ClientWidth     =   8970
  9.    Height          =   7110
  10.    Icon            =   FRMDEMOM.FRX:0000
  11.    Left            =   1410
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   6390
  14.    ScaleWidth      =   8970
  15.    Top             =   990
  16.    Width           =   9120
  17.    Begin CommandButton cmdExit 
  18.       Caption         =   "E&xit"
  19.       Height          =   375
  20.       Left            =   1980
  21.       TabIndex        =   11
  22.       Top             =   3420
  23.       Width           =   1035
  24.    End
  25.    Begin CommandButton cmdGo 
  26.       Caption         =   "&Go"
  27.       Height          =   375
  28.       Left            =   720
  29.       TabIndex        =   10
  30.       Top             =   3420
  31.       Width           =   1095
  32.    End
  33.    Begin TextBox txtDBLocation 
  34.       Height          =   315
  35.       Left            =   3780
  36.       TabIndex        =   12
  37.       Text            =   "C:\VB\BIBLIO.MDB"
  38.       Top             =   3480
  39.       Width           =   5055
  40.    End
  41.    Begin SSFrame Frame3D1 
  42.       Caption         =   "&Demo"
  43.       Height          =   3255
  44.       Left            =   120
  45.       TabIndex        =   14
  46.       Top             =   120
  47.       Width           =   3495
  48.       Begin SSOption o3dDemo 
  49.          Caption         =   "Other New Features"
  50.          Height          =   195
  51.          Index           =   20
  52.          Left            =   180
  53.          TabIndex        =   9
  54.          Top             =   2820
  55.          Width           =   2715
  56.       End
  57.       Begin SSOption o3dDemo 
  58.          Caption         =   "Correlated Subqueries"
  59.          Height          =   195
  60.          Index           =   3
  61.          Left            =   180
  62.          TabIndex        =   3
  63.          Top             =   1080
  64.          Width           =   2715
  65.       End
  66.       Begin SSOption o3dDemo 
  67.          Caption         =   "Top n Query"
  68.          Height          =   195
  69.          Index           =   2
  70.          Left            =   180
  71.          TabIndex        =   2
  72.          Top             =   840
  73.          Width           =   2715
  74.       End
  75.       Begin SSOption o3dDemo 
  76.          Caption         =   "DDL Create Index"
  77.          Height          =   195
  78.          Index           =   12
  79.          Left            =   180
  80.          TabIndex        =   6
  81.          Top             =   1980
  82.          Width           =   2895
  83.       End
  84.       Begin SSOption o3dDemo 
  85.          Caption         =   "Insert using Values clause"
  86.          Height          =   195
  87.          Index           =   14
  88.          Left            =   180
  89.          TabIndex        =   8
  90.          Top             =   2460
  91.          Width           =   2715
  92.       End
  93.       Begin SSOption o3dDemo 
  94.          Caption         =   "DDL Drop Table"
  95.          Height          =   195
  96.          Index           =   13
  97.          Left            =   180
  98.          TabIndex        =   7
  99.          Top             =   2220
  100.          Width           =   2715
  101.       End
  102.       Begin SSOption o3dDemo 
  103.          Caption         =   "DDL Alter Table - add column"
  104.          Height          =   195
  105.          Index           =   11
  106.          Left            =   180
  107.          TabIndex        =   5
  108.          Top             =   1740
  109.          Width           =   2895
  110.       End
  111.       Begin SSOption o3dDemo 
  112.          Caption         =   "DDL Create Table"
  113.          Height          =   195
  114.          Index           =   10
  115.          Left            =   180
  116.          TabIndex        =   4
  117.          Top             =   1500
  118.          Width           =   2715
  119.       End
  120.       Begin SSOption o3dDemo 
  121.          Caption         =   "Sub-Select Query"
  122.          Height          =   195
  123.          Index           =   1
  124.          Left            =   180
  125.          TabIndex        =   1
  126.          Top             =   600
  127.          Width           =   2715
  128.       End
  129.       Begin SSOption o3dDemo 
  130.          Caption         =   "UNION Query"
  131.          Height          =   195
  132.          Index           =   0
  133.          Left            =   180
  134.          TabIndex        =   0
  135.          Top             =   360
  136.          Width           =   2715
  137.       End
  138.    End
  139.    Begin Grid grdDemo 
  140.       Cols            =   10
  141.       FixedCols       =   0
  142.       Height          =   2415
  143.       Left            =   120
  144.       Rows            =   10
  145.       TabIndex        =   13
  146.       Top             =   3840
  147.       Width           =   8715
  148.    End
  149.    Begin Label Label2 
  150.       BackStyle       =   0  'Transparent
  151.       Caption         =   "SQL Command"
  152.       Height          =   255
  153.       Left            =   3900
  154.       TabIndex        =   17
  155.       Top             =   120
  156.       Width           =   1935
  157.    End
  158.    Begin Label lblExampleText 
  159.       BorderStyle     =   1  'Fixed Single
  160.       FontBold        =   0   'False
  161.       FontItalic      =   0   'False
  162.       FontName        =   "MS Sans Serif"
  163.       FontSize        =   9.75
  164.       FontStrikethru  =   0   'False
  165.       FontUnderline   =   0   'False
  166.       Height          =   2775
  167.       Left            =   3780
  168.       TabIndex        =   16
  169.       Top             =   300
  170.       Width           =   4935
  171.    End
  172.    Begin Label Label1 
  173.       BackStyle       =   0  'Transparent
  174.       Caption         =   "Sample DB Location"
  175.       Height          =   255
  176.       Left            =   3780
  177.       TabIndex        =   15
  178.       Top             =   3240
  179.       Width           =   2175
  180.    End
  181.    Begin Shape Shape1 
  182.       BackColor       =   &H00808080&
  183.       BackStyle       =   1  'Opaque
  184.       BorderStyle     =   0  'Transparent
  185.       Height          =   2775
  186.       Left            =   3840
  187.       Top             =   360
  188.       Width           =   4935
  189.    End
  190.    Begin Menu mnuFile 
  191.       Caption         =   "F&ile"
  192.       Begin Menu mnuFileCommands 
  193.          Caption         =   "&About"
  194.          Index           =   0
  195.       End
  196.       Begin Menu mnuFileCommands 
  197.          Caption         =   "E&xit"
  198.          Index           =   1
  199.       End
  200.    End
  201. End
  202. Option Explicit
  203.  
  204. Dim gDefaultDatabase As database
  205. Dim DBOpen_OK As Integer
  206.  
  207. Sub ClearGrid ()
  208.     Dim i As Integer
  209.     Dim j As Integer
  210.  
  211.     For i = 0 To 9
  212.         For j = 0 To 9
  213.             grdDemo.Col = i
  214.             grdDemo.Row = j
  215.             grdDemo.Text = ""
  216.         Next j
  217.     Next i
  218.  
  219. End Sub
  220.  
  221. Sub cmdExit_Click ()
  222.     Unload Me
  223.  
  224. End Sub
  225.  
  226. Sub cmdGo_Click ()
  227.     On Error Resume Next
  228.     
  229.     Dim ds As dynaset
  230.     
  231.     Dim i As Integer
  232.  
  233.     If Not DBOpen_OK Then
  234.         Set gDefaultDatabase = OpenDatabase(txtDBLocation.Text)
  235.         If Err <> 0 Then
  236.             MsgBox "Error Opening: " & txtDBLocation.Text
  237.             Exit Sub
  238.         End If
  239.         DBOpen_OK = True
  240.     End If
  241.  
  242.     ClearGrid
  243.     ResetGridWidths
  244.  
  245.     'UNION Query
  246.     If o3dDemo(0).Value = -1 Then
  247.         Me.MousePointer = 11
  248.  
  249.         grdDemo.ColWidth(1) = 2000
  250.         grdDemo.ColWidth(2) = 1500
  251.  
  252.         grdDemo.Row = 0
  253.         grdDemo.Col = 0
  254.         grdDemo.Text = "ID"
  255.  
  256.         grdDemo.Col = 1
  257.         grdDemo.Text = "Name"
  258.  
  259.         grdDemo.Col = 2
  260.         grdDemo.Text = "Type"
  261.  
  262.         Set ds = gDefaultDatabase.CreateDynaset(lblExampleText)
  263.         If ds.RecordCount <> 0 Then
  264.             i = 1
  265.             Do Until ds.EOF
  266.                 grdDemo.Row = (i)
  267.  
  268.                 grdDemo.Col = 0
  269.                 grdDemo.Text = ds(0)
  270.  
  271.                 grdDemo.Col = 1
  272.                 grdDemo.Text = ds(1)
  273.  
  274.                 grdDemo.Col = 2
  275.                 grdDemo.Text = ds(2)
  276.                 
  277.                 ds.MoveNext
  278.                 i = i + 1
  279.                 If i > 9 Then
  280.                     Exit Do
  281.                 End If
  282.             Loop
  283.         End If
  284.         Me.MousePointer = 0
  285.     End If
  286.     
  287.     'Sub-Select Query
  288.     If o3dDemo(1).Value = -1 Then
  289.         Me.MousePointer = 11
  290.         
  291.         grdDemo.ColWidth(1) = 2000
  292.         grdDemo.ColWidth(2) = 2500
  293.  
  294.         g